package com.myh.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @Description: // 类说明，在创建类时要填写
 * @ClassName: MyRedissonConfig    // 类名，会自动填充
 * @Author: MYH          // 创建者
 * @Date: 2024/5/18 11:01   // 时间
 * @Version: 1.0     // 版本
 */
@Configuration
public class MyRedissonConfig {
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() throws IOException {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://192.168.137.10:6379");
        return Redisson.create(config);
    }
}
